﻿function confirmDelete(delUrl) {
  if (confirm("Are you sure you want to delete")) {
    document.location = delUrl;
  }
}
function OpenPopup(Url) {
   if (confirm("Are you sure you want to authorize this work order?")) {
    document.location = Url;
  }
}

function setVisibleMode(objectId)
{
		var obj = document.getElementById(objectId);
		obj.style.display = 'inline';
}
function setInvisibleMode(objectId)
{
		var obj = document.getElementById(objectId);
		obj.style.display = 'none';
}
function CloseWindow(){
    window.top.self.close();
}

function OpenPopupWindow(Url)
	{
		var feature = "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=no, width="+ (screen.width-screen.width/3) +", height="+ (screen.height-screen.height/2);
		window.open(Url, "myWindow", feature);
	}
function OpenFullPopupWindow(Url)
	{
		var feature = "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=no, width="+ (screen.width-screen.width/3) +", height="+ (screen.height);
		window.open(Url, "myWindow", feature);
	}
function setInVisibleModeToDisplay(caseString,modeTodisplay,isPc)
{
        // I for add
        // 1. no : warrany, generate code, software,hardware tab the first add
        // 2. no : generate code, software,hardware tab
        // 3. no : no software , hardware tab if not pc 
        // 4. have alll after generate code click
        
        // II for modify 
        // 5. have all if pc computer
        // 6. no  : generate code , software , hardware tab if not pc
       
        if(modeTodisplay=="add"){
            
            switch(caseString)
            {
            case 1:
            
               setVisibleMode('tabPurchase');
               setInvisibleMode('tabWarranty');
               setInvisibleMode('tabCodeNumber');
               setInvisibleMode('tabSparepart');
               setInvisibleMode('tabSoftware');  
              break;
            case 2:
              setVisibleMode('tabPurchase');
               setVisibleMode('tabWarranty');
               setInvisibleMode('tabCodeNumber');
               setInvisibleMode('tabSparepart');
               setInvisibleMode('tabSoftware');  
              
              break;
            case 3:
               setVisibleMode('tabPurchase');
               setVisibleMode('tabWarranty');
               setVisibleMode('tabCodeNumber');
               setInvisibleMode('tabSparepart');
               setInvisibleMode('tabSoftware');  
              
              break;
             case 4:
               setVisibleMode('tabPurchase');
               setVisibleMode('tabWarranty');
               setVisibleMode('tabCodeNumber');
               
               if(isPc =="pc"){
                   setVisibleMode('tabSparepart');
                   setVisibleMode('tabSoftware');  
               }
               else {
               
                  setInvisibleMode('tabSparepart');
                  setInvisibleMode('tabSoftware');  
               }
              
              break;
            default:
              
            }
           
        }
        else {
        
            switch(caseString)
            {
            case 5:
            
               setVisibleMode('tabPurchase');
               setVisibleMode('tabWarranty');
               setInvisibleMode('tabCodeNumber');
              
              break;
            case 6:
              setVisibleMode('tabPurchase');
               setVisibleMode('tabWarranty');
               setInvisibleMode('tabCodeNumber');
             
              
              break;
           
            default:
              
            }
             if(isPc =="pc"){
                   setVisibleMode('tabSparepart');
                   setVisibleMode('tabSoftware');  
               }
               else {
                 setInvisibleMode('tabSparepart');
                  setInvisibleMode('tabSoftware');  
               }
        }
     }


